package com.j283_5.wisdom_park.controller.asset_management;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.j283_5.wisdom_park.common.result.ResultData;
import com.j283_5.wisdom_park.pojo.Announcement;
import com.j283_5.wisdom_park.pojo.Tenement;
import com.j283_5.wisdom_park.pojo.Visitors;
import com.j283_5.wisdom_park.service.AnnouncementService;
import com.j283_5.wisdom_park.service.PereeService;
import com.j283_5.wisdom_park.vo.asset_management.AnnouncementVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  公共资源管理
 * </p>
 *
 * @author laoda
 * @since 2022-04-28
 */
@RestController
@RequestMapping("/announcement")
@Api(value = "公共资源管理",tags = "公共资源管理",produces="冯弋舟")
public class AnnouncementController {

    @Resource
    private AnnouncementService service;
    @Resource
    private PereeService pereeService;
    /**
     * 多条件查询公共资源信息
     * @return
     */
    @RequestMapping(value = "/findAnnouncement" , method = RequestMethod.POST)
    @ApiOperation(value = "多条件查询公共资源信息",notes = "多条件查询公共资源信息（分页）",produces="冯弋舟", response = ResultData.class)
    public ResultData findAnnouncement( Page<Announcement> page, String ann_name ){
       return service.findAnnouncement(ann_name,page);
    }

    /**
     * 查询详情
     * @return
     */
    @RequestMapping(value = "/findAnnouncementInfo" , method = RequestMethod.POST)
    @ApiOperation(value = "查询详情",notes = "查询详情",produces="冯弋舟", response = ResultData.class)
    public ResultData findAnnouncementInfo(Integer annId){
        return service.findAnnouncementById(annId);
    }

    /**
     * 删除公共资源
     * @return
     */
    @RequestMapping(value = "/deleteAnnouncement" , method = RequestMethod.POST)
    @ApiOperation(value = "删除公共资源",notes = "删除公共资源",produces="冯弋舟", response = ResultData.class)
    public ResultData deleteAnnouncement(@RequestBody List<Integer> annId){

        return service.deleteAnnouncement(annId);
    }

    /**
     * 进入公告资源界面
     * @return
     */
    @RequestMapping(value = "/AnnouncementInterface" , method = RequestMethod.GET)
    @ApiOperation(value = "进入公告资源界面",notes = "进入公告资源界面",produces="冯弋舟", response = ResultData.class)
    public ResultData AnnouncementInterface(){

      return pereeService.findtenNo();
    }

    /**
     * 进入公告资源新增界面
     * @return
     */
    @RequestMapping(value = "/AnnRoom" , method = RequestMethod.GET)
    @ApiOperation(value = "进入公告资源新增界面",notes = "进入公告资源新增界面",produces="冯弋舟", response = ResultData.class)
    public ResultData AnnRoom(){

        return service.AnnRoom();
    }

    /**
     * 公告资源新增
     * @return
     */
    @RequestMapping(value = "/insertAnnouncement" , method = RequestMethod.GET)
    @ApiOperation(value = "公告资源新增",notes = "公告资源新增",produces="冯弋舟", response = ResultData.class)
    public ResultData insertAnnouncement(AnnouncementVo announcementVo){

        return service.insertAnnouncement(announcementVo);
    }
}

